'use strict'

let Koa = require('koa');
let bodyparser = require('koa-bodyparser');
let server = require('koa-static');

let app = new Koa();

let controllers = require('./controllers');
let templating = require('./templating');
let session = require('./session')

// let model = require('./models');

app.use(session(app));
app.use(bodyparser());
app.use(templating);
app.use(server(__dirname), '/static');
app.use(controllers());

(async () => {
    console.log('正在初始化数据...');
    // await model.sync();
})();

// let part = 3007;
// app.listen(part,()=>{
//     console.log(`http://localhost:${port}`);
// })

let prot = 3005;

app.listen(prot);

console.log(`http://127.0.0.1:${prot}`);